package com.ruoyi.web.controller.app;

import com.ruoyi.assets.dto.StateVisitDTO;
import com.ruoyi.assets.queue.service.MessageProducer;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Api(tags = "app_assets-来客访问")
@RequestMapping("/app/assets/visit")
public class AppVisitController {

    @Resource
    private MessageProducer messageProducer;

    @Anonymous
    @PostMapping("visit")
    public R<Void> visit(@Validated @RequestBody StateVisitDTO dto) {
        messageProducer.sendMessage(Constants.VISIT_QUEUE, dto);
        return R.ok();
    }
}
